package com.tj.tj_java.controller;


import com.tj.tj_java.dto.DanmuDto;
import com.tj.tj_java.pojo.Danmu;
import com.tj.tj_java.result.Result;
import com.tj.tj_java.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class VideoController {

    @Autowired
    private VideoService videoService;


    //通过userId获取视频列表 其实这里的userId没有起什么作用
    @GetMapping("/getAllVideoList/{userId}")
    public Result videoList(@PathVariable int userId){
        return  videoService.getAllVideoList(userId);
    }

    //通过userId获取视频列表 其实这里的userId没有起什么作用
    @GetMapping("/getVideo")
    public Result aVideo(@RequestParam int videoId,@RequestParam int userId){
        return  videoService.getVideo(userId,videoId);
    }

    //添加弹幕
    @PostMapping("/addDanmu")
    public Result addVideoDanmu(@RequestBody DanmuDto danmuDto){
        System.out.println("添加弹幕->"+danmuDto);
        return videoService.addDanmu(danmuDto);
    }

}
